<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
		<title>SPUser Class Reference</title>
		<meta id="xcode-display" name="xcode-display" content="render"/>
		<meta name="viewport" content="width=550" />
		<link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
		<link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
		<meta name="generator" content="appledoc 2.1 (build 840)" />
	</head>
	<body>
		<header id="top_header">
			<div id="library" class="hideInXcode">
				<h1><a id="libraryTitle" href="../index.html">CocoaLibSpotify </a></h1>
				<a id="developerHome" href="../index.html">Spotify AB</a>
			</div>
			
			<div id="title" role="banner">
				<h1 class="hideInXcode">SPUser Class Reference</h1>
			</div>
			<ul id="headerButtons" role="toolbar">
				<li id="toc_button">
					<button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents"><span class="disclosure"></span>Table of Contents</button>
				</li>
				<li id="jumpto_button" role="navigation">
					<select id="jumpTo">
	<option value="top">Jump To&#133;</option>
	
	<option value="overview">Overview</option>
	
	
	
	
	<option value="tasks">Tasks</option>
	
	
	
	
	
	<option value="properties">Properties</option>
	
	<option value="//api/name/canonicalName">&nbsp;&nbsp;&nbsp;&nbsp;canonicalName</option>
	
	<option value="//api/name/displayName">&nbsp;&nbsp;&nbsp;&nbsp;displayName</option>
	
	<option value="//api/name/loaded">&nbsp;&nbsp;&nbsp;&nbsp;loaded</option>
	
	<option value="//api/name/spotifyURL">&nbsp;&nbsp;&nbsp;&nbsp;spotifyURL</option>
	
	<option value="//api/name/user">&nbsp;&nbsp;&nbsp;&nbsp;user</option>
	
	
	
	
	<option value="class_methods">Class Methods</option>
	
	<option value="//api/name/userWithURL:inSession:callback:">&nbsp;&nbsp;&nbsp;&nbsp;+ userWithURL:inSession:callback:</option>
	
	<option value="//api/name/userWithUserStruct:inSession:">&nbsp;&nbsp;&nbsp;&nbsp;+ userWithUserStruct:inSession:</option>
	
	
	
	
	<option value="instance_methods">Instance Methods</option>
	
	<option value="//api/name/initWithUserStruct:inSession:">&nbsp;&nbsp;&nbsp;&nbsp;- initWithUserStruct:inSession:</option>
	
	
	
</select>
				</li>
			</ul>
		</header>
		<nav id="tocContainer" class="isShowingTOC">
			<ul id="toc" role="tree">
				
<li role="treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#overview">Overview</a></span></li>




<li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Creating and Initializing Users">Creating and Initializing Users</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#task_Properties">Properties</a></span></li>
	
</ul></li>





<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#properties">Properties</a></span><ul>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/canonicalName">canonicalName</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/displayName">displayName</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/loaded">loaded</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/spotifyURL">spotifyURL</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/user">user</a></span></li>
	
</ul></li>



<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#class_methods">Class Methods</a></span><ul>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/userWithURL:inSession:callback:">userWithURL:inSession:callback:</a></span></li>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/userWithUserStruct:inSession:">userWithUserStruct:inSession:</a></span></li>
	
</ul></li>



<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
	
	<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithUserStruct:inSession:">initWithUserStruct:inSession:</a></span></li>
	
</ul></li>


			</ul>
		</nav>
		<article>
			<div id="contents" class="isShowingTOC" role="main">
				<a title="SPUser Class Reference" name="top"></a>
				<div class="main-navigation navigation-top">
					<ul>
	<li><a href="../index.html">Index</a></li>
	<li><a href="../hierarchy.html">Hierarchy</a></li>
</ul>
				</div>
				<div id="header">
					<div class="section-header">
						<h1 class="title title-header">SPUser Class Reference</h1>
					</div>		
				</div>
				<div id="container">	
					
					<div class="section section-specification"><table cellspacing="0"><tbody>
						<tr>
	<td class="specification-title">Inherits from</td>
	<td class="specification-value">NSObject</td>
</tr><tr>
	<td class="specification-title">Conforms to</td>
	<td class="specification-value"><a href="../Protocols/SPAsyncLoading.html">SPAsyncLoading</a></td>
</tr><tr>
	<td class="specification-title">Declared in</td>
	<td class="specification-value">SPUser.h<br />SPUser.m</td>
</tr>
						</tbody></table></div>
					
					
					
					
					<div class="section section-overview">
						<a title="Overview" name="overview"></a>
						<h2 class="subtitle subtitle-overview">Overview</h2>
						<p>Represents a <a href="#//api/name/user">user</a> of the Spotify service.</p>

<p>SPUser  is roughly analogous to the sp_<a href="#//api/name/user">user</a> struct in the C LibSpotify API.</p>
					</div>
					
					
					
					
					
					<div class="section section-tasks">
						<a title="Tasks" name="tasks"></a>
						<h2 class="subtitle subtitle-tasks">Tasks</h2>
						
						
						<a title="Creating and Initializing Users" name="task_Creating and Initializing Users"></a>
						<h3 class="subsubtitle task-title">Creating and Initializing Users</h3>

						<ul class="task-list">
							<li>
	<span class="tooltip">
		<code><a href="#//api/name/userWithUserStruct:inSession:">+&nbsp;userWithUserStruct:inSession:</a></code>
		<span class="tooltip"><p>Creates an SPUser from the given opaque sp_<a href="#//api/name/user">user</a> struct.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/userWithURL:inSession:callback:">+&nbsp;userWithURL:inSession:callback:</a></code>
		<span class="tooltip"><p>Creates an SPUser from the given Spotify <a href="#//api/name/user">user</a> URL.</p></span>
	</span>
	
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/initWithUserStruct:inSession:">&ndash;&nbsp;initWithUserStruct:inSession:</a></code>
		<span class="tooltip"><p>Initializes a new SPUser from the given opaque sp_<a href="#//api/name/user">user</a> struct.</p></span>
	</span>
	
	
</li>
						</ul>
						
						
						<a title="Properties" name="task_Properties"></a>
						<h3 class="subsubtitle task-title">Properties</h3>

						<ul class="task-list">
							<li>
	<span class="tooltip">
		<code><a href="#//api/name/canonicalName">&nbsp;&nbsp;canonicalName</a></code>
		<span class="tooltip"><p>Returns the user&rsquo;s canonical username.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/displayName">&nbsp;&nbsp;displayName</a></code>
		<span class="tooltip"><p>Returns the user&rsquo;s display name. If this information isn&rsquo;t available yet, returns the same as <a href="#//api/name/canonicalName">canonicalName</a>.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/loaded">&nbsp;&nbsp;loaded</a></code>
		<span class="tooltip"><p>Returns <code>YES</code> if the <a href="#//api/name/user">user</a> has finished loading and all data is available.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/spotifyURL">&nbsp;&nbsp;spotifyURL</a></code>
		<span class="tooltip"><p>Returns the Spotify URI of the user&rsquo;s profile, for example: <code>spotify:user:ikenndac</code></p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li><li>
	<span class="tooltip">
		<code><a href="#//api/name/user">&nbsp;&nbsp;user</a></code>
		<span class="tooltip"><p>Returns the opaque structure used by the C LibSpotify API.</p></span>
	</span>
	<span class="task-item-suffix">property</span>
	
</li>
						</ul>
						
					</div>
					
					
					
					
					
					<div class="section section-methods">
						<a title="Properties" name="properties"></a>
						<h2 class="subtitle subtitle-methods">Properties</h2>
						
						<div class="section-method">
	<a name="//api/name/canonicalName" title="canonicalName"></a>
	<h3 class="subsubtitle method-title">canonicalName</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Returns the user&rsquo;s canonical username.</p>
	</div>		
	
	
	<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly, copy) NSString *canonicalName</code></div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">SPUser.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/displayName" title="displayName"></a>
	<h3 class="subsubtitle method-title">displayName</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Returns the user&rsquo;s display name. If this information isn&rsquo;t available yet, returns the same as <a href="#//api/name/canonicalName">canonicalName</a>.</p>
	</div>		
	
	
	<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly, copy) NSString *displayName</code></div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">SPUser.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/loaded" title="loaded"></a>
	<h3 class="subsubtitle method-title">loaded</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Returns <code>YES</code> if the <a href="#//api/name/user">user</a> has finished loading and all data is available.</p>
	</div>		
	
	
	<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly, getter=isLoaded) BOOL loaded</code></div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">SPUser.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/spotifyURL" title="spotifyURL"></a>
	<h3 class="subsubtitle method-title">spotifyURL</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Returns the Spotify URI of the user&rsquo;s profile, for example: <code>spotify:user:ikenndac</code></p>
	</div>		
	
	
	<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly, copy) NSURL *spotifyURL</code></div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">SPUser.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/user" title="user"></a>
	<h3 class="subsubtitle method-title">user</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Returns the opaque structure used by the C LibSpotify API.</p>
	</div>		
	
	
	<div class="method-subsection method-declaration"><code>@property (nonatomic, readonly) sp_user *user</code></div>
	
	
	
	
	
	
	
	
	<div class="method-subsection discussion-section">
		<h4 class="method-subtitle">Discussion</h4>
		<div class="warning"><p><strong>Warning:</strong> This method <em>must</em> be called on the libSpotify thread. See the
&ldquo;Threading&rdquo; section of the library&rsquo;s readme for more information.</p></div><div class="warning"><p><strong>Warning:</strong> This should only be used if you plan to directly use the
C LibSpotify API. The behaviour of CocoaLibSpotify is undefined if you use the C
API directly on items that have CocoaLibSpotify objects associated with them.</p></div>
	</div>
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">SPUser.h</code><br />
	</div>				
	
	
</div>
						
					</div>
					
					
					
					<div class="section section-methods">
						<a title="Class Methods" name="class_methods"></a>
						<h2 class="subtitle subtitle-methods">Class Methods</h2>
						
						<div class="section-method">
	<a name="//api/name/userWithURL:inSession:callback:" title="userWithURL:inSession:callback:"></a>
	<h3 class="subsubtitle method-title">userWithURL:inSession:callback:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Creates an SPUser from the given Spotify <a href="#//api/name/user">user</a> URL.</p>
	</div>		
	
	
	<div class="method-subsection method-declaration"><code>+ (void)userWithURL:(NSURL *)<em>userUrl</em> inSession:(SPSession *)<em>aSession</em> callback:(void ( ^ ) ( SPUser *user ))<em>block</em></code></div>
	
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>userUrl</em></dt>
			<dd><p>The <a href="#//api/name/user">user</a> URL to create an SPUser for.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>aSession</em></dt>
			<dd><p>The <a href="../Classes/SPSession.html">SPSession</a> the <a href="#//api/name/user">user</a> should exist in.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>block</em></dt>
			<dd><p>The block to be called with the created SPUser object, or <code>nil</code> if given an invalid <a href="#//api/name/user">user</a> URL.</p></dd>
		</dl>
		
	</div>
	
	
	
	
	
	
	
	<div class="method-subsection discussion-section">
		<h4 class="method-subtitle">Discussion</h4>
		<p>This convenience method creates an SPUser object if one doesn&rsquo;t exist, or
returns a cached SPUser if one already exists for the given URL.</p><div class="warning"><p><strong>Warning:</strong> If you pass in an invalid <a href="#//api/name/user">user</a> URL (i.e., any URL not
starting <code>spotify:user:</code>, this method will return <code>nil</code>.</p></div>
	</div>
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">SPUser.h</code><br />
	</div>				
	
	
</div>
						
						<div class="section-method">
	<a name="//api/name/userWithUserStruct:inSession:" title="userWithUserStruct:inSession:"></a>
	<h3 class="subsubtitle method-title">userWithUserStruct:inSession:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Creates an SPUser from the given opaque sp_<a href="#//api/name/user">user</a> struct.</p>
	</div>		
	
	
	<div class="method-subsection method-declaration"><code>+ (SPUser *)userWithUserStruct:(sp_user *)<em>spUser</em> inSession:(SPSession *)<em>aSession</em></code></div>
	
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>spUser</em></dt>
			<dd><p>The sp_<a href="#//api/name/user">user</a> struct to create an SPUser for.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>aSession</em></dt>
			<dd><p>The <a href="../Classes/SPSession.html">SPSession</a> the <a href="#//api/name/user">user</a> should exist in.</p></dd>
		</dl>
		
	</div>
	
	
	
	<div class="method-subsection return">
		<h4 class="method-subtitle parameter-title">Return Value</h4>
		<p>Returns the created SPUser object.</p>
	</div>
	
	
	
	
	
	<div class="method-subsection discussion-section">
		<h4 class="method-subtitle">Discussion</h4>
		<p>This convenience method creates an SPUser object if one doesn&rsquo;t exist, or
returns a cached SPUser if one already exists for the given struct.</p>
	</div>
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">SPUser.h</code><br />
	</div>				
	
	
</div>
						
					</div>
					
					
					
					<div class="section section-methods">
						<a title="Instance Methods" name="instance_methods"></a>
						<h2 class="subtitle subtitle-methods">Instance Methods</h2>
						
						<div class="section-method">
	<a name="//api/name/initWithUserStruct:inSession:" title="initWithUserStruct:inSession:"></a>
	<h3 class="subsubtitle method-title">initWithUserStruct:inSession:</h3>
	
	
	
	<div class="method-subsection brief-description">
		<p>Initializes a new SPUser from the given opaque sp_<a href="#//api/name/user">user</a> struct.</p>
	</div>		
	
	
	<div class="method-subsection method-declaration"><code>- (id)initWithUserStruct:(sp_user *)<em>aUser</em> inSession:(SPSession *)<em>aSession</em></code></div>
	
	
	<div class="method-subsection arguments-section parameters">
		<h4 class="method-subtitle parameter-title">Parameters</h4>
		
		<dl class="argument-def parameter-def">
			<dt><em>aUser</em></dt>
			<dd><p>The sp_<a href="#//api/name/user">user</a> struct to create an SPUser for.</p></dd>
		</dl>
		
		<dl class="argument-def parameter-def">
			<dt><em>aSession</em></dt>
			<dd><p>The <a href="../Classes/SPSession.html">SPSession</a> the <a href="#//api/name/user">user</a> should exist in.</p></dd>
		</dl>
		
	</div>
	
	
	
	<div class="method-subsection return">
		<h4 class="method-subtitle parameter-title">Return Value</h4>
		<p>Returns the created SPUser object.</p>
	</div>
	
	
	
	
	
	<div class="method-subsection discussion-section">
		<h4 class="method-subtitle">Discussion</h4>
		<div class="warning"><p><strong>Warning:</strong> This method <em>must</em> be called on the libSpotify thread. See the
&ldquo;Threading&rdquo; section of the library&rsquo;s readme for more information.</p></div><div class="warning"><p><strong>Warning:</strong> For better performance and built-in caching, it is recommended
you create SPUser objects using <a href="#//api/name/userWithUserStruct:inSession:">[SPUser userWithUserStruct:inSession:]</a>,
<a href="#//api/name/userWithURL:inSession:callback:">[SPUser userWithURL:inSession:callback:]</a> or the instance methods on <a href="../Classes/SPSession.html">SPSession</a>.</p></div>
	</div>
	
	
	
	
	
	
	
	<div class="method-subsection declared-in-section">
		<h4 class="method-subtitle">Declared In</h4>
		<code class="declared-in-ref">SPUser.h</code><br />
	</div>				
	
	
</div>
						
					</div>
					
					
				</div>
				<div class="main-navigation navigation-bottom">
					<ul>
	<li><a href="../index.html">Index</a></li>
	<li><a href="../hierarchy.html">Hierarchy</a></li>
</ul>
				</div>
				<div id="footer">
					<hr />
					<div class="footer-copyright">
						<p><span class="copyright">&copy; 2012 Spotify AB. All rights reserved. (Last updated: 2012-11-14)</span><br />
						
						<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.1 (build 840)</a>.</span></p>
						
					</div>
				</div>
			</div>
		</article>
		<script type="text/javascript">
			function jumpToChange()
			{
				window.location.hash = this.options[this.selectedIndex].value;
			}
			
			function toggleTOC()
			{
				var contents = document.getElementById('contents');
				var tocContainer = document.getElementById('tocContainer');
				
				if (this.getAttribute('class') == 'open')
				{
					this.setAttribute('class', '');
					contents.setAttribute('class', '');
					tocContainer.setAttribute('class', '');
					
					window.name = "hideTOC";
				}
				else
				{
					this.setAttribute('class', 'open');
					contents.setAttribute('class', 'isShowingTOC');
					tocContainer.setAttribute('class', 'isShowingTOC');
					
					window.name = "";
				}
				return false;
			}
			
			function toggleTOCEntryChildren(e)
			{
				e.stopPropagation();
				var currentClass = this.getAttribute('class');
				if (currentClass == 'children') {
					this.setAttribute('class', 'children open');
				}
				else if (currentClass == 'children open') {
					this.setAttribute('class', 'children');
				}
				return false;
			}
			
			function tocEntryClick(e)
			{
				e.stopPropagation();
				return true;
			}
			
			function init()
			{
				var selectElement = document.getElementById('jumpTo');
				selectElement.addEventListener('change', jumpToChange, false);
				
				var tocButton = document.getElementById('table_of_contents');
				tocButton.addEventListener('click', toggleTOC, false);
				
				var taskTreeItem = document.getElementById('task_treeitem');
				if (taskTreeItem.getElementsByTagName('li').length > 0)
				{
					taskTreeItem.setAttribute('class', 'children');
					taskTreeItem.firstChild.setAttribute('class', 'disclosure');
				}
				
				var tocList = document.getElementById('toc');
				
				var tocEntries = tocList.getElementsByTagName('li');
				for (var i = 0; i < tocEntries.length; i++) {
					tocEntries[i].addEventListener('click', toggleTOCEntryChildren, false);
				}
				
				var tocLinks = tocList.getElementsByTagName('a');
				for (var i = 0; i < tocLinks.length; i++) {
					tocLinks[i].addEventListener('click', tocEntryClick, false);
				}
				
				if (window.name == "hideTOC") {
					toggleTOC.call(tocButton);
				}
			}
			
			window.onload = init;
			
			// If showing in Xcode, hide the TOC and Header
			if (navigator.userAgent.match(/xcode/i)) {
				document.getElementById("contents").className = "hideInXcode"
				document.getElementById("tocContainer").className = "hideInXcode"
				document.getElementById("top_header").className = "hideInXcode"
			}
			
		</script>
	</body>
</html>